package hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import entity.*;

 
public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 
             config.addAnnotatedClass(Sucursal.class);
             config.addAnnotatedClass(Area.class);
             config.addAnnotatedClass(Cocina.class);
             config.addAnnotatedClass(Barra.class);
             config.addAnnotatedClass(Cafeteria.class);
             config.addAnnotatedClass(Salon.class);
             config.addAnnotatedClass(CajaDiaria.class);
             config.addAnnotatedClass(Empleado.class);
             config.addAnnotatedClass(EmpProduccion.class);
             config.addAnnotatedClass(Cajero.class);
             config.addAnnotatedClass(Mozo.class);
             config.addAnnotatedClass(Liquidacion.class);
             config.addAnnotatedClass(MesaSimple.class);
             config.addAnnotatedClass(MesaCompuesta.class);
             config.addAnnotatedClass(Mesa.class);
             config.addAnnotatedClass(CompraNoVenta.class);
             config.addAnnotatedClass(CompraVenta.class);
             config.addAnnotatedClass(ElaboradoNoVenta.class);
             config.addAnnotatedClass(ElaboradoVenta.class);
             config.addAnnotatedClass(Receta.class);
             config.addAnnotatedClass(ItemReceta.class);
             config.addAnnotatedClass(Producto.class);
             config.addAnnotatedClass(PlanProduccion.class);
             config.addAnnotatedClass(Tarea.class);
             config.addAnnotatedClass(Lote.class);
             config.addAnnotatedClass(StockProducto.class);
             config.addAnnotatedClass(RubroCarta.class);
             config.addAnnotatedClass(DArea.class);
             config.addAnnotatedClass(DSucursal.class);
             config.addAnnotatedClass(Deposito.class);
             config.addAnnotatedClass(DCentral.class);
             config.addAnnotatedClass(Comanda.class);
             config.addAnnotatedClass(Carta.class);
             config.addAnnotatedClass(CajaDiaria.class);
             config.addAnnotatedClass(Caja.class);
             config.addAnnotatedClass(Sector.class);
             config.addAnnotatedClass(ItemComanda.class);
             config.addAnnotatedClass(Factura.class);
             config.addAnnotatedClass(ItemFactura.class);
             config.addAnnotatedClass(Movimiento.class);
             config.addAnnotatedClass(Plato.class);
             config.addAnnotatedClass(AdministracionCentral.class);
             config.addAnnotatedClass(EmpAdministracion.class);
             
             
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
 
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}


